import java.io.IOException;
import java.io.ObjectInputStream;
import java.net.Socket;

public class ClientRecv implements Runnable{
    private Socket socket;
    private ObjectInputStream ois;

    public ClientRecv(Socket socket,ObjectInputStream ois){
        this.socket=socket;
        this.ois=ois;
    }
    public void run() {
        while(socket!=null){
            try {
                String msg= (String) ois.readObject();
                System.out.println(msg);

            } catch (IOException e) {
                System.out.println("服务器宕机，请稍后再试！");
                System.exit(-1);
            } catch (ClassNotFoundException e) {
                e.printStackTrace();
            }
        }
    }
}
